// const baseUrl = "http://192.168.12.185:8083"
const baseUrl = "http://47.111.24.97:8083"
function requst(method, path, data, Authorization) {
  return new Promise(result => {
    uni.request({
      url: baseUrl + path,
      method: method,
      header: {
        "Authorization": Authorization,
        'Device': "android",
        // 'Content-Type': 'application/json',
      },
      data,
      success: res => {
        result(res)
      }
    })
  })
}

// 园区列表
const park = (data) => {
  const url = "/AppApi/parkList"
  return requst("get", url, data, '')
}

// 文章列表
const Party = (type, num, page, parkId, Authorization, data) => {
  const url = `/AppApi/article?type=${type}&num=${num}&page=${page}&parkId=${parkId}`
  return requst("get", url, data, Authorization)
}

// 文章详情
const Details = (id,Authorization,data) => {
  const url = `/AppApi/articleDetail?id=${id}`
  return requst("get", url,data, Authorization)
}

// 园区数据
const Solar = (Authorization, data) => {
  const url = `/AppApi/yuanqushuju?Authorization=${Authorization}`
  return requst("post", url, data, Authorization)
}

// 光伏历史接口
const Guang = (Authorization,data) => {
  const url = `/AppApi/guangfulishi_detail`
  return requst("post", url, data, Authorization)
}
// 园区环境历史数据
const Yuan = (Authorization,data) =>{
	const url = `/AppApi/parklishi_envir`
	return requst("post",url,data,Authorization)
}
// 人员流量历史数据
const Ren = (Authorization,data) =>{
	const url = `/AppApi/people_flowlishi`
	return requst("post",url,data,Authorization)
}
// 车辆进出历史记录
const Che = (Authorization,data) =>{
	const url =`/AppApi/car_flowlishi`
	return requst("post",url,data,Authorization)
}
// 更新当前用户资料
const users = (Authorization,park_id,data) => {
	const url = `/AppApi/users?Authorization=${Authorization}&park_id=${park_id}`
	return requst("post", url,data,Authorization)
}
//监控
const Supervisory = (Authorization,data) => {
	const url = `/AppApi/monitor_list?Authorization=${Authorization}`
	return requst("post", url,data,Authorization)
}
// 企业代办  测不通
const behalf = (company_backlog,data) => {
	const url = `/AppApi/home/company-backlog?company_backlog=${company_backlog}`
	return requst("get", url,data)
}
// 访客预约
const visitor = (Authorization,data) => {
	const url = `/AppApi/visitor?Authorization=${Authorization}`
	return requst("get", url,data,Authorization)
}
 // 企业资产管理
 const Assets= (Authorization,page,size,data) =>{
	 const url = `/AppApi/assets_detail?Authorization=${Authorization}&page=${page}&size=${size}`
	 return requst("post",url,data,Authorization)
 }
 // 公司资产详情
 const ZiDetails= (Authorization,comp_id,data) =>{
	 const url = `/AppApi/comassets_detailtop?Authorization=${Authorization}&comp_id=${comp_id}`
	 return requst("post",url,data,Authorization)
 }
 // 资产其他详情接口
 const Qi = (Authorization,page,size,comp_id,data) =>{
	 const url = `/AppApi/comassets_detailother?Authorization=${Authorization}&page=${page}&size=${size}&comp_id=${comp_id}`
	 return requst("post",url,data,Authorization)
 }
 // 删除资产接口
 const Shan = (Authorization,id,data) =>{
	 const url = `/AppApi/assets_delete?Authorization=${Authorization}&id=${id}`
	 return requst("post",url,data,Authorization)
 }
 // 资产权限
 const Quan = (Authorization,data) =>{
	const url = `/AppApi/AuthorityList?Authorization=${Authorization}`
	return requst("post",url,data,Authorization)
 }
 // 权限分配列表接口
 const Xian = (Authorization,code,data) =>{
 	const url = `/AppApi/Auth_asslist?Authorization=${Authorization}&code=${code}`
 	return requst("post",url,data,Authorization)
 }
 // 宿舍列表
 const Dormitory = (Authorization,parentId,data) =>{
	 const url = `/AppApi/searchDormInfo?Authorization?=${Authorization}&parentId=${parentId}`
	 return requst("post",url,data,Authorization)
 }
 // 二维码
 const Dimensional = (Authorization,device_code,data) =>{
	 const url = `/AppApi/assets_qrcode?Authorization=${Authorization}&device_code=${device_code}`
	return requst("post",url,data,Authorization)
 }
 // 巡检记录
 const Inspection = (Authorization,status,images,description,device_code,device_time,name,address,dead_line,data) =>{
	 const url = `/AppApi/assets_Inspection?Authorization=${Authorization}&status=${status}&images=${images}&description=${description}&device_code=${device_code}&device_time=${device_time}&name=${name}&address=${address}&dead_line=${dead_line}`
	 return requst("post",url,data,Authorization)
 }
export {
  park,
  Party, //园区质询
  Details,
  Solar,
  Guang, //光伏历史记录
  users,
  Supervisory,  //监控
  behalf,   //代办
  visitor,  //访客
  Yuan,  //园区环境历史
  Ren,  //人员流量历史
 Che, //车进出历史记录
 Assets,//资产管理
 ZiDetails,//资产详情
 Qi,       //资产其他详情接口
 Shan,  //删除资产接口
 Quan,  //权限资产接口
 Xian,  //权限分配
 Dormitory, //宿舍列表
 Dimensional,  //二维码
 Inspection
}


// // 更新当前用户资料
// const users = (Authorization,nickname,avatar,push_cid,gender,birthday,park_id,company_id,dormitory_id,logo,business_license,name,images,username,mobile,email,company_url,data) => {
// 	const url = `/AppApi/users?Authorization=${Authorization}&nickname=${nickname}
// &avatar=${avatar}
// &push_cid=${push_cid}
// &gender=${gender}
// &birthday=${birthday}
// &park_id=${park_id}
// &company_id=${company_id}
// &dormitory_id=${dormitory_id}
// &logo=${logo}
// &business_license=${business_license}
// &name=${name}
// &images=${images}
// &username=${username}
// &mobile=${mobile}
// &email=${email}
// &company_url=${company_url}`
// 	return requst("get", url,data,Authorization)
// }